package com.zrkj.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * @author : 国良
 * @className : TSysRole
 * @package: com.ha.entity
 * @description : 用户组表 实例类
 * @date :  2021-05-14
 */
@Getter
@Setter
@Accessors(chain = true)
@ToString
@TableName("t_sys_role")
@ApiModel(value = "TSysRole", description = "用户组表")
public class TSysRole implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 全局唯一编号
     */
    @TableId(value = "id", type = IdType.ID_WORKER_STR)
    @ApiModelProperty(value = "全局唯一编号")
    private String id;

    @TableField(exist = false)
    private List<String> stationIds=new ArrayList<>();

    @TableField(exist = false)
    private List<TSysRoleResource> roleResources=new ArrayList<>();

    @TableField(exist = false)
    private List<TSysResource> resourcesInfo=new ArrayList<>();

    @TableField(exist = false)
    private List<TSysRoleStation> roleStations=new ArrayList<>();

    @TableField(exist = false)
    private List<String> resources=new ArrayList<>();


    /**
     * 名称
     */
    @TableField("`name`")
    @ApiModelProperty(value = "名称")
    private String name;


    /**
     * 用户组类型（admin,editor,viewer)
     */
    @TableField("`type`")
    @ApiModelProperty(value = "用户组类型（admin,editor,viewer)")
    private String type;


    /**
     * 唯一标识
     */
    @TableField("`url`")
    @ApiModelProperty(value = "唯一标识")
    private String url;


    /**
     * 地址
     */
    @TableField("`addr`")
    @ApiModelProperty(value = "地址")
    private String addr;


    /**
     * 特征
     */
    @TableField("`tag`")
    @ApiModelProperty(value = "特征")
    private String tag;


    /**
     * 描述
     */
    @TableField("`desc`")
    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 备注
     */
    @TableField("`remark`")
    @ApiModelProperty(value = "备注")
    private String remark;


    /**
     * 状态
     */
    @TableField("`status`")
    @ApiModelProperty(value = "状态")
    private Integer status;


    /**
     * 创建日期
     */
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建日期")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;


    /**
     * 创建人uuid
     */
    @TableField("create_by")
    @ApiModelProperty(value = "创建人uuid")
    private String createBy;


    /**
     * 修改日期
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "创建日期")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;


    /**
     * 修改人uuid
     */
    @TableField("update_by")
    @ApiModelProperty(value = "修改人uuid")
    private String updateBy;


    /**
     * 父级编号
     */
    @TableField("parent_id")
    @ApiModelProperty(value = "父级编号")
    private String parentId;


    /**
     * 所属业主
     */
    @TableField("owner_id")
    @ApiModelProperty(value = "所属业主")
    private String ownerId;



    @TableField(exist = false)
    private Long current;

    @TableField(exist = false)
    private Long size;

    public Page getPage() {

        return new Page(null != this.getCurrent() ? this.getCurrent() : 1L, null != this.getSize() ? this.getSize() : 10L);
    }

}
